// 加载受控文档配置文件
var configMenuJSON = 'config/product.json';
$.getJSON(configMenuJSON, function (data) {
    var htmldata = '';
    var htmlModaldata = '';
    $.each(data,function (i, item) {
        htmldata +=  '<div class="col-xs-12 col-sm-6 col-md-3"><div class="card">'
                + '<div class="card-content">'
                    + '<span class="card-title">' + item.title +'</span>'
                    + '<p>简介：' + item.desc +'</p>'
                + '</div>'
                + '<div class="card-action">';
        if(item.url == '') {
            htmldata +=  '<a  href="#' + item.modalName + '" class="waves-effect waves-light btn">演示环境</a>';
        }
        else {
            htmldata +=  '<a  href="' + item.url + '" target="_blank" class="waves-effect waves-light btn">演示环境</a>'
        }
        htmldata +=   '</div></div></div>';
    })
    $.each(data,function (i, item) {
        if(item.url == '') {
            htmlModaldata += '<div id="' + item.modalName +'" class="modal" style="width: 1920px;">'
                + '<div class="modal-footer" style="width: 1920px; height: 1080px"> <a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat">X</a> </div>'
                + '<div class="modal-content" >'
                + item.modalContent
                + '</div></div>';
        }
    })

    $("#product-list").html(htmldata);
    $("#page-row").after(htmlModaldata);
    $("#page-row").after('<script src="js/modal.js"></script>');
})

